package ilender.util;

import com.google.common.io.BaseEncoding;

/**
 * Tools for handling the base64-url encoding.*/
public final class Base64Url{
	/*Instantiation Guard*/private Base64Url(){}

	/**Decodes from Base64-url using UTF8*/
	public static String decode(String source){
		try{
			return new String(BaseEncoding.base64().decode(source.replace("-","+").replace("_","/").trim()),"UTF8");
		}catch(Exception e){
			throw new RuntimeException("Unable to decode string",e);
		}
	}
}
